/*
 * @Author: 颜礼田 2564217790@qq.com
 * @Date: 2024-09-10 11:05:38
 * @LastEditors: 颜礼田 2564217790@qq.com
 * @LastEditTime: 2024-09-10 11:21:06
 * @FilePath: /webServerAdmin/src/api/modules/department.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import http from "@/api";
import { PORT1 } from "@/api/config/servicePort";
import { DepartmentSchema } from "@/schema";
import { Id } from "../interface";

export function saveDept(data: DepartmentSchema) {
  return http.post<DepartmentSchema>(`${PORT1}/department/save`, data);
}

export function fetchDeptTrees() {
  return http.get<{ list: Array<DepartmentSchema> }>(`${PORT1}/department/trees`);
}

export function fetchDeptInfo(params: Id) {
  return http.get<DepartmentSchema>(`${PORT1}/department/info`, params);
}

export function removeDept(params: Id) {
  return http.delete<DepartmentSchema>(`${PORT1}/department/remove`, params);
}

export function editDept(params: Id, data: DepartmentSchema) {
  return http.put<DepartmentSchema>(`${PORT1}/department/edit`, data, { params });
}
